<div class="content-section implementation GridDemo" id="myContent" >
    <div class="title col-sm-12">
        <div class="col-sm-1">
            <span>{{formTitle}}</span>
        </div>
        <div class="col-sm-11 pull-right">
            <button type="button"
                    class="pull-right"
                    pButton
                    (click)="goBack()"
                    icon="fa-close"
                    style="width: 30px"></button>
        </div>
    </div>
    <form [formGroup]="myForm" class="form-horizontal">
        <div class="form-group">
            <label class="col-sm-2 control-label">服务单号：</label>
            <div class="col-sm-10 ui-no-padding-left-15px ui-fluid">
                <input type="text" pInputText
                       class="form-control cursor_not_allowed"
                       placeholder="自动生成"
                       readonly
                       [ngModelOptions]="{standalone: true}"
                       [(ngModel)]="formObj.sid"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">来源：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="dropdownOption.fromx"
                            [(ngModel)]="formObj.fromx"
                            [placeholder]="formObj.fromx"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
            <label class="col-sm-2 control-label">状态：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.status"
                       [ngModelOptions]="{standalone: true}"
                       readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>报障人：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <div class="col-sm-6 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           placeholder="请选择报障人"
                           readonly
                           formControlName="submitter"
                           [(ngModel)]="formObj.submitter"
                           class=" form-control cursor_not_allowed"
                    />
                    <div class="ui-message ui-messages-error ui-corner-all" *ngIf="Submitter">
                        <i class="fa fa-close"></i>
                        不能为空
                    </div>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="showTreeDialog('submitter')" label="选择"></button>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="clearTreeDialog('submitter')" label="清空"></button>
                </div>
            </div>
            <label class="col-sm-2 control-label">所属组织：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.submitter_org"
                       [ngModelOptions]="{standalone: true}"
                       readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">联系电话：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.submitter_phone"
                       [ngModelOptions]="{standalone: true}"
                       readonly />
            </div>
            <label class="col-sm-2 control-label">受理时间：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.create_time"
                       [ngModelOptions]="{standalone: true}"
                       readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>发生时间：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-calendar [(ngModel)]="formObj.occurrence_time"
                            [showIcon]="true"
                            [locale]="zh"
                            name="end_time"
                            dateFormat="yy-mm-dd"
                            [required]="true"
                            [ngModelOptions]="{standalone: true}"
                            [showSeconds]="true"
                            [maxDate]="maxDate"
                            [showTime]="true">
                </p-calendar>
            </div>
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>最终期限：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       [ngModelOptions]="{standalone: true}"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.deadline"
                       readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>影响度：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="dropdownOption.influence"
                            [(ngModel)]="formObj.influence"
                            (onFocus)="onFocus()"
                            [placeholder]="formObj.influence"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>紧急度：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <p-dropdown [options]="dropdownOption.urgency"
                            [(ngModel)]="formObj.urgency"
                            (onFocus)="onFocus()"
                            [placeholder]="formObj.urgency"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label">优先级：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [(ngModel)]="formObj.priority"
                       [ngModelOptions]="{standalone: true}"
                       readonly />
            </div>
            <label class="col-sm-2 control-label">故障级别：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="dropdownOption.level"
                            [(ngModel)]="formObj.level"
                            (onFocus)="onFocus()"
                            [placeholder]="formObj.level"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>

        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>所属系统：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="dropdownOption.bt_system"
                            [(ngModel)]="formObj.bt_system"
                            [placeholder]="formObj.bt_system"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
            <label class="col-sm-2 control-label">发生地点：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <div class="col-sm-6 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           readonly
                           [(ngModel)]="formObj.addr"
                           [ngModelOptions]="{standalone: true}"
                           class=" form-control cursor_not_allowed"
                    />
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" label="选择"></button>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" label="清空"></button>
                </div>
            </div>
        </div>


        <div class="form-group ">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>故障标题：</label>
            <div class="col-sm-10 ui-no-padding-left-15px ui-fluid">
                <input type="text" pInputText
                       formControlName="title"
                       [(ngModel)]="formObj.title"/>
                <div class="ui-message ui-messages-error ui-corner-all" *ngIf="title">
                    <i class="fa fa-close"></i>
                    不能为空
                </div>
            </div>

        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>故障描述：
            </label>
            <div class="col-sm-10 ui-no-padding-left-15px ui-fluid">
                 <textarea [rows]="5" pInputTextarea
                           autoResize="autoResize"
                           formControlName="content"
                           [(ngModel)]="formObj.content"></textarea>
                <div class="ui-message ui-messages-error ui-corner-all" *ngIf="content">
                    <i class="fa fa-close"></i>
                    不能为空
                </div>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label">
                上传附件：
            </label>
            <div class="col-sm-9 ui-fluid-no-padding ">
                <p-fileUpload name="file" url="{{ip}}/workflow/servicerequest/upload"
                              multiple="multiple"
                              accept="image/*,application/*,text/*"
                              chooseLabel="选择"
                              uploadLabel="上传"
                              cancelLabel="取消"
                              maxFileSize="3145728"
                              (onUpload)="onUpload($event)"
                              (onBeforeUpload)="onBeforeUpload($event)"
                              #form>
                    <ng-template pTemplate="content">
                        <ul *ngIf="uploadedFiles?.length">
                            <li *ngFor="let file of uploadedFiles">{{file.name}} - {{file.size}} bytes</li>
                        </ul>
                    </ng-template>
                </p-fileUpload>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label">
                关联服务目录：
            </label>
            <div class="col-sm-10 ui-fluid-no-padding">
                <div class="col-sm-10 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           name="department" placeholder="请选择关联服务目录"
                           readonly
                           class="form-control cursor_not_allowed"/>
                </div>
                <div class="col-sm-1 ui-fluid-no-padding ui-padding-10px">
                    <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button"  label="选择"></button>
                </div>
                <div class="col-sm-1 ui-fluid-no-padding ui-padding-10px">
                    <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button"  label="清空"></button>
                </div>
            </div>
        </div>
        <div class="form-group ">
            <label  class="col-sm-2 control-label">
                关联设备编号：
            </label>
            <div class="col-sm-10 ui-fluid-no-padding">
                <div class="col-sm-10 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           name="department" placeholder="请选择关联设备编号"
                           readonly
                           class="form-control cursor_not_allowed"/>
                </div>
                <div class="col-sm-1 ui-fluid-no-padding ui-padding-10px">
                    <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button"  label="选择"></button>
                </div>
                <div class="col-sm-1 ui-fluid-no-padding ui-padding-10px">
                    <button ngClass="ui-g-12 ui-fluid-no-padding" pButton type="button"  label="清空"></button>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>分配至部门：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <div class="col-sm-6 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           readonly
                           [(ngModel)]="formObj.acceptor_org"
                           formControlName="acceptor"
                           class=" form-control cursor_not_allowed"
                    />
                    <div class="ui-message ui-messages-error ui-corner-all" *ngIf="acceptor">
                        <i class="fa fa-close"></i>
                        不能为空
                    </div>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="showTreeDialog('department')" label="选择"></button>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="clearTreeDialog('department')" label="清空"></button>
                </div>
            </div>
            <label class="col-sm-2 control-label">分配至个人：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="dropdownOption.acceptor"
                            [(ngModel)]="formObj.acceptor"
                            placeholder="{{formObj.acceptor}}"
                            (onChange)="onChange($event)"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
                <!--{{formObj.acceptor}}-->
                <!--{{formObj.acceptor_pid}}-->
            </div>
        </div>
        <div class="form-group ">
            <div class="col-sm-12 ui-no-padding-left-15px ui-no-padding-right-15px">
                <button class="pull-right  ui-button-secondary" pButton type="button"
                        (click)="goBack()" label="取消"></button>
                <button class="pull-right ui-margin-right-10px" pButton type="button" (click)="submitAndDistribute ()" label="提交并分配"></button>
                <button class="pull-right ui-margin-right-10px" pButton type="button" (click)="submitTrick()" label="提交"></button>
                <button  class="pull-right ui-margin-right-10px" pButton type="button" (click)="save()" label="保存"></button>

            </div>
        </div>
    </form>
    <p-dialog header="请选择" [(visible)]="display" modal="modal" width="300" [responsive]="true">
        <p-tree [value]="filesTree4"
                selectionMode="single"
                [(selection)]="selected"
                (onNodeExpand)="nodeExpand($event)"
        ></p-tree>
        <!--<div style="margin-top:8px">Selected Node: {{selected ? selected.label : 'none'}}</div>-->
        <p-footer>
            <button type="button" pButton icon="fa-check" (click)="closeTreeDialog()" label="确定"></button>
            <button type="button" pButton icon="fa-close" (click)="display=false"
                    class="ui-button-secondary" label="取消"></button>
        </p-footer>
    </p-dialog>
  <app-personel-dialog *ngIf="displayPersonel"
                       (dataEmitter)="dataEmitter($event)"
                       (displayEmitter)="displayEmitter($event)">

  </app-personel-dialog>
  <p-growl [(value)]="message"></p-growl>

</div>
